package com.example.basic;

public class Test2 {
    public static void main(String[] args) {
        //使用lambda表达式实现接口

        //无参
        IB ib = () -> {
            System.out.println("test");
        };
        ib.test();

        //有参
        IC ic = (name, age) -> {
            System.out.println(name + age + "岁了！");
        };
        ic.test("小新", 18);

        //有参+返回值(参数类型可以省略，要省需全省)
        ID id = (String name, int age) -> {
            System.out.println(name + age + "岁了！");
            return age + 1;
        };
        int age = id.test("小新", 18);
        System.out.println(age);

    }
}
